#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define endl "\n"
#define y1 Y1
#define pb(x) push_back(x)
#define PII pair<int, int>
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define _for(i, a, b) for(int i = a; i <= b; ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;

const int N = 1e5 + 10;
set<pair<int, int>>s;

signed main() {
	IOS;
	int n, m;
	cin >> n >> m;
	
	_for(i, 1, m) {
		int k;
		cin >> k;
		vector<int>v;
		_for(i, 1, k) {
			int x;
			cin >> x;
			v.push_back(x);
		}
		for(int i : v) {
			for(int j : v) {
			//	cout << i << j << endl;
				s.emplace(i, j);
			}
		}
	}
	//cout << s.size() << endl;
	if(s.size() < n * n) {
		No
	}
	else Yes
	return 0;
}

